function post_avatar() {
    var fd=new FormData();
    fd.append("file",$("#post-avatar")[0].files[0])
    $.ajax({
        type: "post",
        url: "http://"+ip+"/data/request/changeAvatar",
        async: true,
        data: fd,
        dataType: 'json',
        beforeSend: function (xhr) {
            xhr.setRequestHeader("token", localStorage.getItem('token'))
        },
        xhrFields: {
            withCredentials: true
        },
        success: function (data)
        {
            initUserInfo();
            alert(data.reason);
        },
        processData: false,
        contentType: false,

    });
}
function getAvatar_path()
{


        get("http://"+ip+"/data/request/index", function (data) {
            if (data.code === 200) {

                $("#page").attr("src",data.t);
            } else if (data.code == 500) {
                alert(data.reason)
                window.location = "login.html"
            }

        }, function () {

        })

}
